#include "stdcharanim.h"

const std::string Oribi::StdCharAnim::names[N_STD_CHAR_ANIM] =
    {
        "IdleAnim",
        "WalkRightAnim"
    };

const std::string Oribi::StdCharAnim::dirNames[8] =
    {
        "Right",
        "RightUp",
        "Up",
        "LeftUp",
        "Left",
        "LeftDown",
        "Down",
        "RightDown"
    };

std::string Oribi::StdCharAnim::getName(int anim, int dir)
{
    if (dir == -1)
        return names[anim];

    if (dir < 0 || dir >= 8)
        dir = 0;

    std::string res = names[anim];
    res.append(dirNames[dir]);

    return res;
}

int Oribi::StdCharAnim::getAnim(int a, int dir)
{
    if (dir < 0 || dir >= N_STD_CHAR_ANIM)
        dir = 0;
    if (a < 0 || a > N_STD_CHAR_ANIM)
        return dir;
    return a * 8 + dir;
}

int Oribi::StdCharAnim::Idle(int dir)
{
    if (dir < 0 || dir >= 8)
        dir = 0;
    return IdleID * 8 + dir;
}

int Oribi::StdCharAnim::Walk(int dir)
{
    if (dir < 0 || dir >= 8)
        dir = 0;
    return WalkID * 8 + dir;
}

int Oribi::StdCharAnim::Run(int dir)
{
    if (dir < 0 || dir >= 8)
        dir = 0;
    return RunID * 8 + dir;
}
